﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InvestigateReport.aspx.cs" Inherits="Honestysoft.Financing.WebUI.Module.Project.InvestigateReport" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>现场考察报告</title>
   <link href="../../Styles/control.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../../Uploadify/js/jquery.min.js"></script>
    <link rel="Stylesheet" href="../../Uploadify/js/uploadify.css" />
    <script language="javascript" type="text/javascript" src="../../Uploadify/js/swfobject.js"></script> 
    <script language="javascript" type="text/javascript" src="../../Uploadify/js/jquery.uploadify.min.js"></script>     
    
    <script language="javascript" type="text/javascript">
        function getRootPath() {
            var strFullPath = window.document.location.href;
            var strPath = window.document.location.pathname;
            var pos = strFullPath.indexOf(strPath);
            var prePath = strFullPath.substring(0, pos);
            var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
            return (prePath + postPath);
        }
        var rootPath=getRootPath();
        function openWord() {            
            var filaName = rootPath+'/<%=_FilePath %>';
            document.all.MyOffice.Open(filaName, false, "Word.Document");
            //进入不留痕状态
            document.all.MyOffice.SetTrackRevisions(0);
            //只有“打开”菜单可用 
            //document.all.MyOffice.SetMenuDisplay(0);
            //接受当前修订
            document.all.MyOffice.SetTrackRevisions(4);
            //document.all.MyOffice.close(); //关闭
        }
        function saveWord() {
            if(postWord()){
                alert("保存成功！");
            }
            else{
                alert("无法保存当前文档！");
            }
        }
        function postWord() {
            //初始化Http引擎
            document.all.MyOffice.HttpInit();
            //增加Post变量
            document.all.MyOffice.HttpAddPostString("FileID", "<%=Request["ID"] %>");
//            document.all.MyOffice.HttpAddPostString("UserID", "李局长");
            //上传打开的文件
            //            document.all.MyOffice.HttpAddPostCurrFile("FileData", "文档名.doc");
            document.all.MyOffice.HttpAddPostCurrFile("FileData", '');
            //执行上传动作
            try
            {
                document.all.MyOffice.HttpPost(rootPath+ "/Module/Project/Json/UploadProjectInvestigage.ashx");
            }
            catch(e){
                return false;
            }
            return true;
        }
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#uploadify").uploadify({
                'uploader': '../../Uploadify/js/uploadify.swf',
                'script': 'Json/UploadProjectInvestigateFile.ashx?DataID=<%=Request["ID"] %>',
                'cancelImg': '../../Uploadify/js/cancel.png',
                'folder': '',
                'wmode': 'transparent ',
                'queueID': 'fileQueue',
                'auto': true,
                'multi': false,
                'width': 66,
                'height': 16,
                'buttonImg': '../../Uploadify/images/addAtt2.png',
                'fileExt': '*.doc;*.docx',
                'fileDesc':'请选择doc或docx文件',
                'onComplete': function (event, queueID, fileObj, response, data) {
                },
                'onAllComplete': function (event, data) {
                    openWord();
                },
                'onSelect': function (e, queueId, fileObj) {
                }
            });
        });
</script> 
</head>
<body onload="openWord()">
    <form id="form1" runat="server">
  <div class="infoContainer" id="infoContainer">当前项目：<%=Request.QueryString["SN"]%>&nbsp;&nbsp;<%=Request.QueryString["Name"]%><br />
    <input type="button" id="btnSave" name="btnSave" value="保存" onclick="saveWord();" class="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'" /><span style="font-size:9pt;color:Red;font-weight:700">（注意：修改文档后，必须使用此保存按钮才能正确保存到服务器上。）</span>
            <br /><span style="font-size:9pt">如果您已有编辑好的Word文档，可直接点击</span>
    <input type="file" name="uploadify" id="uploadify" /> 
<div id="fileQueue"></div><input type="button" id="btnUpload" style="display:none" class="cancel" onclick="javascript:$('#uploadify').uploadifyUpload();return false;" />

    </div>
            <div style="text-align: center;">
           <OBJECT classid="clsid:00460182-9E5E-11D5-B7C8-B8269041DD57" name='MyOffice' id="MyOffice" style="LEFT:0px; TOP:0px; WIDTH:100%; HEIGHT:650px" CodeBase="dsoframer.cab#version=2,3,0,1">
                    <PARAM NAME="_ExtentX" VALUE="6350">
                    <PARAM NAME="_ExtentY" VALUE="6350">
                    <PARAM NAME="BorderColor" VALUE="-2147483632">
                    <PARAM NAME="BackColor" VALUE="-2147483643">
                    <PARAM NAME="ForeColor" VALUE="-2147483640">
                    <PARAM NAME="TitlebarColor" VALUE="-2147483635">
                    <PARAM NAME="TitlebarTextColor" VALUE="-2147483634">
                    <PARAM NAME="BorderStyle" VALUE="1">
                    <PARAM NAME="Titlebar" VALUE="0">
                    <PARAM NAME="Toolbars" VALUE="1">
                    <PARAM NAME="Menubar" VALUE="1">
            </OBJECT>
        </div>
    </form>
    <script language="javascript" type="text/javascript">
        document.all.MyOffice.style.height = window.screen.availHeight - 130;
    </script>
</body>
</html>
